"use strict";
var nrc = require('./osUti');



/**
 * @name restart
 * 重启
 */


/**
 * @name all
 * 重启所有服务
 * @tip 会重启当前机器上所有服务
 */
exports.all = async function () {
	try {
		await nrc.getPromise('/opt/sword/nodejs/restart.sh');
		return 'Finish';
	} catch (err) {
		return err;
	}
}


/**
 * @name game
 * 重启Game服务
 */
exports.game = async function () {
	try {
		console.log("restart game server");
		// `date -s "${arg}"`
		let arg = '/root/bonglocal/game/start.sh';
		await nrc.getPromise(`sh "${arg}"`);
		// await nrc.getPromise('/root/bonglocal/game/start.sh');
		return 'Finish';
	} catch (err) {
		return err;
	}
}


/**
 * @name battle
 * 重启Battle服务
 */
exports.battle = async function () {
	try {
		await nrc.getPromise('/opt/sword/nodejs/restartBattle.sh');
		return 'Finish';
	} catch (err) {
		return err;
	}
}



